<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="utf-8">
    <title>车库信息</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge">

    <!-- 百度地图密钥 -->
    <script src="//api.map.baidu.com/api?type=webgl&v=1.0&ak=cOR2POv5Qc5zVT2aOxToLXs8vG1wuOo6"></script>
</head>

<body>
    <div id="allmap"></div>
</body>

</html>
<script>
        var map = new BMapGL.Map("allmap");
        var output = "从你的位置到仓库驾车需要";
        var searchComplete = function (results){
            if (transit.getStatus() != BMAP_STATUS_SUCCESS){
                return ;
            }
            var plan = results.getPlan(0);
             output += plan.getDuration(true) + "\n";                //获取时间
             output += "总路程为:" ;
             output += plan.getDistance(true) + "\n";             //获取距离
        }
        var transit = new BMapGL.DrivingRoute(map, {renderOptions: {map: map},
            onSearchComplete: searchComplete,
            onPolylinesSet: function(){        
                setTimeout(function(){alert(output)},"100");
        }});
        var start=new BMapGL.Point(108.954083, 34.323146);
        var end=new BMapGL.Point(108.952094,34.320818);
        transit.search(start, end);
        var cr = new BMapGL.CopyrightControl({
            anchor: BMAP_ANCHOR_TOP_RIGHT,
            offset: new BMapGL.Size(20, 20)
        });   //设置版权控件位置
	    map.addControl(cr); //添加版权控件
        var bs = map.getBounds();   //返回地图可视区域
	    cr.addCopyright({
            id: 1, 
            content: "<img src='../img/1.jpg' width='50px' height='50px'/><a href='http://localhost:8081/#/zt_Stall' style='font-size:16px;color:#000'>个人订单信息</a>", 
            bounds: bs
        });
</script>
<style>
     html,body{
            width: 100%;
            height: 100%;
            padding: 0;
            margin: 0;
        }
    #allmap{
            width: 100%;
            height: 100%;
            overflow: hidden;
        } 
</style>